<#include "/layout/_layout.ftl" />
<@head title="四眼井-发布讨论">
<link href="${static_domain}/js/jquery-validation/validate.min.css" type="text/css" rel="stylesheet"/>
</@head>
<@body 4>
<div class="mgl-20 mgr-20">
	<div class="ui-box">
		<div class="ui-box-title">
			<h3>发布讨论</h3>
		</div>
		<div class="ui-box-container ui-box-content">
			<form action="/discuss/create" method="post" class="ui-form" id="add_form">
			${errormsg!}
				<div class="ui-form-item">
					<label for="" class="ui-label">
						讨论标题
					</label>
					<input class="ui-input {required:true,maxlength:30,minlength:10}" type="text"
					       name="discuss.title" id="title" style="width:650px">
				</div>
				<div class="ui-form-item">
					<label for="" class="ui-label">
						讨论内容
					</label>
					<textarea id="editor" name="discuss.content"
					          style="width:660px;height:500px"></textarea>
				</div>
				<div class="ui-form-item">
					<input type="submit" class="btn-g blue" value="发布">
				</div>
			</form>
		</div>
	</div>
</div>
</@body>
<@script>
<script src="${static_domain}/js/kindeditor/kindeditor-min.js"></script>
<script src="${static_domain}/js/jquery-validation/validate.min.js"></script>
<script src="${static_domain}/js/jquery-validation/jquery.metadata.min.js"></script>
<script type="text/javascript">
	var editor;
	KindEditor.ready(function (K) {
		editor = K.create('#editor', {
			items: ['bold', 'italic', 'underline', 'strikethrough', 'lineheight',
				'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright',
				'justifyfull', 'insertorderedlist', 'insertunorderedlist',
				'indent', 'outdent', 'subscript','superscript', 'clearhtml',
				'quickformat', '|' , 'source', 'code', 'formatblock', 'fontname',
				'fontsize', '|', 'forecolor', 'hilitecolor', 'image','flash', 'insertfile',
				'table', 'hr', 'emoticons', 'baidumap', 'pagebreak', 'anchor', 'link', 'unlink']
		});
	});
	$(function () {
		$("#add_form").validate({
			submitHandler: function (form) {
				if (editor.html() == "") {
					alert('内容不能为空');
					return false;
				}
				form.submit();
			}
		});
	})
</script>
</@script>
